package com.immediatus.graphics.font;

import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Typeface;
import com.immediatus.graphics.contracts.ITexture;

public class StrokeFont extends Font{
    private final Paint _paint;
    private final boolean _strokeOnly;

    public StrokeFont(final ITexture tex_, final Typeface typeface_, final float size_, final boolean antiAlias_, final int color_, final float w_, final int strokeColor_){
        this(tex_, typeface_, size_, antiAlias_, color_, w_, strokeColor_, false);
    }

    public StrokeFont(final ITexture tex_, final Typeface typeface_, final float size_, final boolean antiAlias_, final int color_, final float w_, final int strokeColor_, final boolean _strokeOnly){
        super(tex_, typeface_, size_, antiAlias_, color_);
        this._paint = new Paint();
        this._paint.setTypeface(typeface_);
        this._paint.setStyle(Style.STROKE);
        this._paint.setStrokeWidth(w_);
        this._paint.setColor(strokeColor_);
        this._paint.setTextSize(size_);
        this._paint.setAntiAlias(antiAlias_);
        this._strokeOnly = _strokeOnly;
    }

    @Override
    protected void drawCharacterString(final String str_){
        if (!this._strokeOnly){
            super.drawCharacterString(str_);
        }
        this.getCanvas().drawText(str_, LETTER_LEFT_OFFSET, -this.getFontMetrics().ascent, this._paint);
    }
}
